package com.ktjiaoyu.crm.repository;

import com.ktjiaoyu.crm.entity.CustLost;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;


public interface LostRepository extends JpaRepository<CustLost,Long>, JpaSpecificationExecutor<CustLost> {
    public CustLost getLostByLstCustNo(String custNo);

    @Query(value = "select * from cst_lost where TIMESTAMPDIFF(DAY,lst_last_order_date,DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%S')) > 180",nativeQuery = true)
    public List<CustLost> findLostsByLstLastOrderDate();
}
